//
//  HHTagItemModel.m
//  ZHTagList
//
//  Created by admin on 2018/7/17.
//

#import "HHTagItemModel.h"

@implementation HHTagItemModel
@synthesize uniqueId = _uniqueId;
@synthesize name = _name;
@synthesize selected = _selected;
@synthesize extData = _extData;
@synthesize value = _value;
@synthesize exclude = _exclude;


/// copy 协议
/// @param zone zone description
- (id)copyWithZone:(NSZone *)zone {
    typeof(self) one = [self.class new];
    one.uniqueId = self.uniqueId;
    one.name = self.name;
    one.selected = self.selected;
    one.extData = self.extData;
    one.value = self.value;
    one.exclude = self.exclude;
    return one;
}

/// 自定义相等判断
/// @param object object description
- (BOOL)isEqual:(id)object {
    if (self == object) {
        return YES;
    }
    if (!object) {
        return NO;
    }
    if (![object isKindOfClass:[HHTagItemModel class]]) {
        return NO;
    }
    // 字符串相等则相等
    HHTagItemModel *model = (HHTagItemModel *)object;
    if (model.name) {
        return [model.name isEqualToString:self.name];
    }else {
        return model.uniqueId.integerValue == self.uniqueId.integerValue;
    }
}

@end
